{{ ansible_managed | comment }}
# this is a config file for zabbix agent
# to get more information about zabbix, visit http://www.zabbix.com

############ general parameters #################

### option: pidfile
#       name of pid file.
#
{% if zabbix_agent_os_family != "Windows" %}
PidFile={{ zabbix_agent_pidfile }}
{% endif %}

### option: logfile
#       name of log file.
#       if not set, syslog is used.
#
{% if zabbix_agent_os_family == "Windows" %}
LogFile={{ zabbix_agent_win_logfile }}
{% else %}
LogFile={{ zabbix_agent_logfile }}
{% endif %}

### option: logfilesize
#       maximum size of log file in mb.
#       0 - disable automatic log rotation.
#
LogFileSize={{ zabbix_agent_logfilesize }}

### option: debuglevel
#       specifies debug level
#       0 - no debug
#       1 - critical information
#       2 - error information
#       3 - warnings
#       4 - for debugging (produces lots of information)
#
DebugLevel={{ zabbix_agent_debuglevel }}


### option: sourceip
#       source ip address for outgoing connections.
#
{% if zabbix_agent_sourceip is defined and zabbix_agent_sourceip %}
SourceIP={{ zabbix_agent_sourceip }}
{% endif %}

### option: enableremotecommands
#       whether remote commands from zabbix server are allowed.
#       0 - not allowed
#       1 - allowed
#
EnableRemoteCommands={{ zabbix_agent_enableremotecommands }}

### option: logremotecommands
#       enable logging of executed shell commands as warnings.
#       0 - disabled
#       1 - enabled
#
LogRemoteCommands={{ zabbix_agent_logremotecommands }}

##### passive checks related

### option: server
#       list of comma delimited ip addresses (or hostnames) of zabbix servers.
#       incoming connections will be accepted only from the hosts listed here.
#       no spaces allowed.
#       if ipv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally.
#
# mandatory: yes
# default:
# server=
Server={{ zabbix_agent_server }}

### option: listenport
#       agent will listen on this port for connections from the server.
#
ListenPort={{ zabbix_agent_listenport }}


### option: listenip
#       list of comma delimited ip addresses that the agent should listen on.
#       first ip address is sent to zabbix server if connecting to it to retrieve list of active checks.
#
{% if zabbix_agent_listenip !='0.0.0.0' %}
ListenIP={{ zabbix_agent_listenip }}
{% endif %}

### option: startagents
#       number of pre-forked instances of zabbix_agentd that process passive checks.
#       if set to 0, disables passive checks and the agent will not listen on any tcp port.
#
StartAgents={{ zabbix_agent_startagents }}

##### active checks related
### option: serveractive
#       list of comma delimited ip:port (or hostname:port) pairs of zabbix servers for active checks.
#       if port is not specified, default port is used.
#       ipv6 addresses must be enclosed in square brackets if port for that host is specified.
#       if port is not specified, square brackets for ipv6 addresses are optional.
#       if this parameter is not specified, active checks are disabled.
#       example: serveractive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
#
ServerActive={{ zabbix_agent_serveractive }}

### option: hostname
#       unique, case sensitive hostname.
#       required for active checks and must match hostname as configured on the server.
#       value is acquired from hostnameitem if undefined.
#
{% if zabbix_agent_hostname is defined and zabbix_agent_hostname %}
Hostname={{ zabbix_agent_hostname }}
{% endif %}

### option: hostnameitem
#       item used for generating hostname if it is undefined.
#       ignored if hostname is defined.
#
{% if zabbix_agent_hostnameitem is defined and zabbix_agent_hostnameitem %}
HostnameItem={{ zabbix_agent_hostnameitem }}
{% endif %}

### option: hostmetadata
#	optional parameter that defines host metadata.
#	host metadata is used at host auto-registration process.
#	an agent will issue an error and not start if the value is over limit of 255 characters.
#	if not defined, value will be acquired from hostmetadataitem.
#
{% if zabbix_agent_hostmetadata is defined and zabbix_agent_hostmetadata %}
HostMetadata={{ zabbix_agent_hostmetadata }}
{% endif %}

### option: hostmetadataitem
#	optional parameter that defines an item used for getting host metadata.
#	host metadata is used at host auto-registration process.
#	during an auto-registration request an agent will log a warning message if
#	the value returned by specified item is over limit of 255 characters.
#	this option is only used when hostmetadata is not defined.
#
{% if zabbix_agent_hostmetadataitem is defined and zabbix_agent_hostmetadataitem %}
HostMetadataItem={{ zabbix_agent_hostmetadataitem }}
{% endif %}

### option: refreshactivechecks
#       how often list of active checks is refreshed, in seconds.
#
RefreshActiveChecks={{ zabbix_agent_refreshactivechecks }}

### option: buffersend
#       do not keep data longer than n seconds in buffer.
#
BufferSend={{ zabbix_agent_buffersend }}

### option: buffersize
#       maximum number of values in a memory buffer. the agent will send
#       all collected data to zabbix server or proxy if the buffer is full.
#
BufferSize={{ zabbix_agent_buffersize }}

### option: maxlinespersecond
#       maximum number of new lines the agent will send per second to zabbix server
#       or proxy processing 'log' and 'logrt' active checks.
#       the provided value will be overridden by the parameter 'maxlines',
#       provided in 'log' or 'logrt' item keys.
#
MaxLinesPerSecond={{ zabbix_agent_maxlinespersecond }}

############ advanced parameters #################

### option: alias
#       sets an alias for parameter. it can be useful to substitute long and complex parameter name with a smaller and simpler one.
#
{% if zabbix_agent_zabbix_alias is defined and zabbix_agent_zabbix_alias %}
Alias={{ zabbix_agent_zabbix_alias }}
{% endif %}

### option: timeout
#       spend no more than timeout seconds on processing
#
Timeout={{ zabbix_agent_timeout }}

{% if zabbix_agent_os_family != "Windows" %}
### option: allowroot
#       allow the agent to run as 'root'. if disabled and the agent is started by 'root', the agent
#       will try to switch to user 'zabbix' instead. has no effect if started under a regular user.
#       0 - do not allow
#       1 - allow
#
AllowRoot={{ zabbix_agent_allowroot }}
{% endif %}

### Option: User
#	Drop privileges to a specific, existing user on the system.
#	Only has effect if run as 'root' and AllowRoot is disabled.
#
# Mandatory: no
# Default:

{% if zabbix_agent_runas_user is defined and zabbix_agent_runas_user %}
User={{ zabbix_agent_runas_user }}
{% endif %}

### option: include
#       you may include individual files or all files in a directory in the configuration file.
#       installing zabbix will create include directory in /usr/local/etc, unless modified during the compile time.
#
{% if zabbix_agent_os_family == "Windows" %}
Include={{ zabbix_agent_win_include }}
{% else %}
Include={{ zabbix_agent_include }}
{% endif %}

####### user-defined monitored parameters #######

### option: unsafeuserparameters
#       allow all characters to be passed in arguments to user-defined parameters.
#       0 - do not allow
#       1 - allow
#
UnsafeUserParameters={{ zabbix_agent_unsafeuserparameters }}

### option: userparameter
#       user-defined parameter to monitor. there can be several user-defined parameters.
#       format: userparameter=<key>,<shell command>
#       note that shell command must not return empty string or eol only.
#       see 'zabbix_agentd' directory for examples.
#
# mandatory: no
# default:
# userparameter=

# disabled. an configuration file should be placed on directory: {{ zabbix_agent_include }}

####### LOADABLE MODULES #######
{% if zabbix_version is version_compare('2.2', '>=') %}
### Option: LoadModulePath
#       Full path to location of agent modules.
#       Default depends on compilation options.
#
{% if zabbix_agent_os_family != "Windows" %}
LoadModulePath={{ zabbix_agent_loadmodulepath }}
{% endif %}
{% endif %}

### Option: LoadModule
#       Module to load at agent startup. Modules are used to extend functionality of the agent.
#       Format: LoadModule=<module.so>
#       The modules must be located in directory specified by LoadModulePath.
#       It is allowed to include multiple LoadModule parameters.
#
{% if zabbix_agent_loadmodule is defined and zabbix_agent_loadmodule %}
LoadModule={{ zabbix_agent_loadmodule }}
{% endif %}

{% if zabbix_version is version_compare('3.0', '>=') %}
####### TLS-RELATED PARAMETERS #######

### Option: TLSConnect
#       How the agent should connect to server or proxy. Used for active checks.
#       Only one value can be specified:
#               unencrypted - connect without encryption
#               psk         - connect using TLS and a pre-shared key
#               cert        - connect using TLS and a certificate
#
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection)
# Default:
# TLSConnect=unencrypted
{% if zabbix_agent_tlsconnect is defined and zabbix_agent_tlsconnect %}
TLSConnect={{ zabbix_agent_tlsconnect }}
{% endif %}

### Option: TLSAccept
#       What incoming connections to accept.
#       Multiple values can be specified, separated by comma:
#               unencrypted - accept connections without encryption
#               psk         - accept connections secured with TLS and a pre-shared key
#               cert        - accept connections secured with TLS and a certificate
#
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection)
# Default:
# TLSAccept=unencrypted
{% if zabbix_agent_tlsaccept is defined and zabbix_agent_tlsaccept %}
TLSAccept={{ zabbix_agent_tlsaccept }}
{% endif %}

### Option: TLSCAFile
#       Full pathname of a file containing the top-level CA(s) certificates for
#       peer certificate verification.
#
# Mandatory: no
# Default:
# TLSCAFile=
{% if zabbix_agent_tlscafile is defined and zabbix_agent_tlscafile %}
TLSCAFile={{ zabbix_agent_tlscafile }}
{% endif %}

### Option: TLSCRLFile
#       Full pathname of a file containing revoked certificates.
#
# Mandatory: no
# Default:
# TLSCRLFile=
{% if zabbix_agent_tlscrlfile is defined and zabbix_agent_tlscrlfile %}
TLSCRLFile={{ zabbix_agent_tlscrlfile }}
{% endif %}

### Option: TLSServerCertIssuer
#      Allowed server certificate issuer.
#
# Mandatory: no
# Default:
# TLSServerCertIssuer=
{% if zabbix_agent_tlsservercertissuer is defined and zabbix_agent_tlsservercertissuer %}
TLSServerCertIssuer={{ zabbix_agent_tlsservercertissuer }}
{% endif %}

### Option: TLSServerCertSubject
#      Allowed server certificate subject.
#
# Mandatory: no
# Default:
# TLSServerCertSubject=
{% if zabbix_agent_tlsservercertsubject is defined and zabbix_agent_tlsservercertsubject %}
TLSServerCertSubject={{ zabbix_agent_tlsservercertsubject }}
{% endif %}

### Option: TLSCertFile
#       Full pathname of a file containing the agent certificate or certificate chain.
#
# Mandatory: no
# Default:
# TLSCertFile=
{% if zabbix_agent_tlscertfile is defined and zabbix_agent_tlscertfile %}
TLSCertFile={{ zabbix_agent_tlscertfile }}
{% endif %}

### Option: TLSKeyFile
#       Full pathname of a file containing the agent private key.
#
# Mandatory: no
# Default:
# TLSKeyFile=
{% if zabbix_agent_tlskeyfile is defined and zabbix_agent_tlskeyfile %}
TLSKeyFile={{ zabbix_agent_tlskeyfile }}
{% endif %}

### Option: TLSPSKIdentity
#       Unique, case sensitive string used to identify the pre-shared key.
#
# Mandatory: no
# Default:
# TLSPSKIdentity=
{% if zabbix_agent_tlspskidentity is defined and zabbix_agent_tlspskidentity %}
TLSPSKIdentity={{ zabbix_agent_tlspskidentity }}
{% endif %}

### Option: TLSPSKFile
#       Full pathname of a file containing the pre-shared key.
#
# Mandatory: no
# Default:
# TLSPSKFile=
{% if zabbix_agent_tlspskfile is defined and zabbix_agent_tlspskfile %}
TLSPSKFile={{ zabbix_agent_tlspskfile }}
{% endif %}
{% endif %}
